package com.atguigu.demo.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * className: CounterController
 * description:
 * date: 2024/5/28-9:34
 * <p>
 * project: java-demo
 * package: com.atguigu.demo.controller
 * email: 1085844536@qq.com
 * version:
 *
 * @author WangGuojian
 */
@RestController
public class CounterController {

    @Autowired
    private StringRedisTemplate redisTemplate;

    @GetMapping("/hello")
    public String count() {
        Long increment = redisTemplate.opsForValue().increment("count-people");
        return "有 [" + increment + "] 人访问了这个页面";
    }
}
